package pre.liuxl.blog.service.serviceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pre.liuxl.blog.entity.UserFile;
import pre.liuxl.blog.repository.UserFileRepository;
import pre.liuxl.blog.service.UserFileService;

import java.util.List;

/**
 * Created by liuxuanlong on 2018/6/29.
 */
@Service
public class UserFileServiceImpl implements UserFileService {
    @Autowired
    UserFileRepository userFileRepository;

    @Override
    public List<UserFile> findAllUserFile() {
        return userFileRepository.findAll();
    }

    @Override
    public void saveFile(String fileName, Integer userId, String fileInfo, String filePath) {
        UserFile userFile = new UserFile();
        userFile.setUserId(userId);
        userFile.setFileName(fileName);
        userFile.setFilePath(filePath);
        userFile.setFileInfo(fileInfo);
        userFileRepository.save(userFile);
    }
}
